import App from './App';
import globalMethods from './common/functions';
import {
	createSSRApp
} from 'vue';

import {
	store1,
	store1Key,
	store2,
	store2Key,
	userInfoStore,
	userKey
} from './src/store';

export function createApp() {
	const app = createSSRApp(App)
	app.use(store1, store1Key);
	app.use(store2, store2Key);
	app.use(userInfoStore, userKey);
	// 遍历公共方法对象，将每个方法注册到全局
	for (const [key, value] of Object.entries(globalMethods)) {
		app.config.globalProperties[key] = value;
		// app.config.globalProperties.key = value;
	}
	return {
		app
	}
}